<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var lst = [10, 5, 9, 1, 3, 2, 6, 13, 11, 12, 8, 0]

      //.....................................................

      function ChooseSort(lst) {
        for (let j = 0; j < lst.length - 1; j++) {
          let minIndex = j
          for (let i = j + 1; i < lst.length; i++) {
            if (lst[i] < lst[minIndex]) {
              minIndex = i
            }
          }
          //与第j位变量交换值
          var middle = lst[j]
          lst[j] = lst[minIndex]
          lst[minIndex] = middle
        }
        return lst 
      }

      console.log(ChooseSort(lst))
    </script>
  </body>
</html>
